<?php
/**
 * Created by PhpStorm.
 * User: HCDX
 * Date: 2018/5/31
 * Time: 11:17
 */
namespace app\admin\validate;
use think\Validate;

class Admin extends Validate
{
    protected $rule = [
      'name' => 'unique:admin|require|max:25',
      'password' => 'require|max:6',
      'phone'    => 'require|max:11',
      'email' => 'email',
    ];
    protected  $message = [
        'name.require'=>'管理员名称不得为空！',
        'name.unique'=>'管理员名称不得重复！',
        'password.require'=>'管理员密码不得为空！',
        'password.min'=>'密码不得少于6为！',
        'phone.require'=>'手机号不能为空',
        'phone.max'=>'手机号不能少于11位',
        'email'        => '邮箱格式错误',
    ];

    protected $scene = [
        'add'=>['name','password'=>'min:6','phone'=>'min:11','email'],
        'edit'=>['name','password'=>'min:6'],
    ];
}
